import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'
import { Icon, Field, Dialog } from 'vant'

import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/dist/index.css'
import './views/styles/global.css'

const pinia = createPinia()
const app = createApp(App)

// 注册 Vant 组件
app.use(Icon)
app.use(Field)
app.use(Dialog)

app.use(ElementPlus).use(router)

// 注册Element puls图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(pinia) // 确保这一行在挂载应用之前
app.mount('#app')
